﻿using System;
using System.Collections.Generic;
using Budgetsch.Web.EntityModel;
using Budgetsch.Web.Services;
using GalaSoft.MvvmLight;
using System.Collections.ObjectModel;

namespace Budgetsch.ViewModels.Savings
{
    public class AddSavingVM : SavingDetailVMBase
    {
        public event Action ItemAdded;
        public AddSavingVM(BudgetschDomainContext context_)
            : base(context_)
        {
            Saving = new Saving() { Date = DateTime.Now};
        }

        public override void Commit()
        {
            m_context.Savings.Add(Saving);
            m_context.SubmitChanges();
            ItemAdded();
        }
    }
}